package com.demo.design.behavioral.visitor;

import java.util.ArrayList;
import java.util.List;

public class ElementStructure {

    private List<Element> elementList = new ArrayList<>();

    public void setElement(Element element) {
        elementList.add(element);
    }

    public void visit(Visitor visitor) {
        elementList.forEach(element -> {
            System.err.println(element.getClass());
            element.accept(visitor);
        });
    }
}
